<?php

/**
 * TbcPlan form base class.
 *
 * @method TbcPlan getObject() Returns the current form's model object
 *
 * @package    AltargetEcommerce
 * @subpackage form
 * @author     Carlo Lopez
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTbcPlanForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'plan_codigo'      => new sfWidgetFormInputHidden(),
      'plan_nombre'      => new sfWidgetFormInputText(),
      'plan_descripcion' => new sfWidgetFormInputText(),
      'plan_tipo'        => new sfWidgetFormInputText(),
      'plan_mens'        => new sfWidgetFormInputText(),
      'plan_maxenvios'   => new sfWidgetFormInputText(),
      'plan_escaleramin' => new sfWidgetFormInputText(),
      'plan_escaleramax' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'plan_codigo'      => new sfValidatorChoice(array('choices' => array($this->getObject()->get('plan_codigo')), 'empty_value' => $this->getObject()->get('plan_codigo'), 'required' => false)),
      'plan_nombre'      => new sfValidatorString(array('max_length' => 50)),
      'plan_descripcion' => new sfValidatorString(array('max_length' => 200)),
      'plan_tipo'        => new sfValidatorString(array('max_length' => 1)),
      'plan_mens'        => new sfValidatorString(array('max_length' => 1)),
      'plan_maxenvios'   => new sfValidatorInteger(array('required' => false)),
      'plan_escaleramin' => new sfValidatorInteger(array('required' => false)),
      'plan_escaleramax' => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('tbc_plan[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TbcPlan';
  }

}
